/* ************************************************************
   Nueva tabla para loquear las conexiones con web services

   Ale - 10/2019
  ************************************************************ */

CREATE SEQUENCE seq_websrvlog
  INCREMENT 1
  MINVALUE 1
  MAXVALUE 9223372036854775807;

CREATE TABLE public.websrvlog
(
  id integer NOT NULL DEFAULT nextval('seq_websrvlog'::regclass),
  idcomm integer,
  tipooper character varying(20), 
  url text,
  txtxml text,
  equipo character varying(20),
  idambdb integer, 
  fechainsert timestamp without time zone, 
  fechaupdate timestamp without time zone,
  CONSTRAINT websrvlog_pkey PRIMARY KEY (id)
 )
WITH (
  OIDS=TRUE
);
ALTER TABLE public.websrvlog OWNER TO abacouser;
COMMENT ON TABLE public.websrvlog IS 'Registros de consumo de web services';
COMMENT ON COLUMN public.websrvlog.idcomm IS 'Id del comprobante';
COMMENT ON COLUMN public.websrvlog.tipooper IS 'Tipo de operacion Request/Response';
COMMENT ON COLUMN public.websrvlog.url IS 'URL de la conexion';
COMMENT ON COLUMN public.websrvlog.txtxml IS 'XML de intercambio de datos';
COMMENT ON COLUMN public.websrvlog.equipo IS 'Nombre del equipo llamador';


-- ====== Trigger auditoria =====
CREATE TRIGGER control_audit_websrvlog
  BEFORE INSERT OR UPDATE OR DELETE
  ON public.websrvlog
  FOR EACH ROW
  EXECUTE PROCEDURE public.tg_control_audit_instancia();


-- =====================================
SELECT aaversion('416.00');
-- =====================================